package com.minggo.charmword.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.EditText;
import android.widget.ImageView;

import com.baidu.mobstat.StatService;
import com.minggo.charmword.R;
import com.minggo.charmword.service.CharmWordApplication;

/**
 * 单词搜索
 * 
 * @author minggo
 * @date 2014-9-2 上午10:59:52
 */
public class SearchActivity extends Activity implements OnClickListener {

	private View backV;
	private EditText inputEd;
	private ImageView deleteIV;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_search);
		getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		initUI();
		CharmWordApplication.allActivities.add(this);
	}

	/**
	 * 初始化UI
	 */
	private void initUI() {
		backV = findViewById(R.id.lo_search_back);
		inputEd = (EditText) findViewById(R.id.ed_search);
		deleteIV = (ImageView) findViewById(R.id.iv_clear_text);

		backV.setOnClickListener(this);
		deleteIV.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.lo_search_back:

			onBackPressed();
			break;
		case R.id.iv_clear_text:

			break;

		default:
			break;
		}
	}

	@Override
	public void onBackPressed() {
		super.onBackPressed();
		overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);
	}

	@Override
	protected void onPause() {
		super.onPause();
		StatService.onPause(this);
	}

	@Override
	protected void onResume() {
		super.onResume();
		StatService.onResume(this);
	}
}
